package main

import (
	"fmt"
	"time"
)

func newTask() {
	for i := 0; i < 200; i++ {
		fmt.Printf("new Goroutine:i= %d\n", i)
		time.Sleep(1 * time.Second)
	}
}

//goroutine 并行执行 多线程
func main() {
	//创建一个go线程 去执行newTask()流程
	go newTask()
	for i := 0; i < 200; i++ {
		fmt.Printf("main goroutine: i= %d\n", i)
		time.Sleep(1 * time.Second)
	}

	fmt.Println("")
}
